#include "MLPlayListViewer.h"
#include "ui_MLPlayListViewer.h"

#include <QDir>
#include <QFileSystemModel>

MLPlayListViewer::MLPlayListViewer(QStringList *playlist, QWidget *parent) :
    QDialog(parent),
    _pUi(new Ui::MLPlayListViewer)
{
    _pUi->setupUi(this);


    _pFileSystemModel = new QFileSystemModel();
    _pFileSystemModel->setRootPath(QDir::rootPath());
    _pUi->treeView->setModel(_pFileSystemModel);
    _pUi->treeView->setRootIsDecorated(true);
    _pUi->treeView->setRootIndex(_pFileSystemModel->index(QDir::rootPath()));
    _pUi->treeView->setCurrentIndex(_pFileSystemModel->index(QDir::homePath()));
    _pUi->treeView->setColumnHidden(1,true);
    _pUi->treeView->setColumnHidden(2,true);
    _pUi->treeView->setColumnHidden(3,true);

    _pPlaylist = playlist;

}

MLPlayListViewer::~MLPlayListViewer()
{
    delete _pUi;
}

void MLPlayListViewer::showIt()
{
    _pUi->listWidget->clear();
    _pUi->listWidget->addItems((*_pPlaylist));
    show();
}
